package cn.kshost.zqyg.manager.service.impl;

import cn.kshost.zqyg.manager.mapper.SysRoleMenuMapper;
import cn.kshost.zqyg.manager.service.SysRoleMenuService;
import cn.kshost.zqyg.model.dto.system.AssginMenuDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
@Transactional
@Service
public class SysRoleMenuServiceImpl implements SysRoleMenuService {
    @Autowired
    SysRoleMenuMapper sysRoleMenuMapper;

    @Override
    public List<Long> findSysRoleMenuByRoleId(Integer roleId) {
       return sysRoleMenuMapper.selectSysRoleMenuByRoleId(roleId);

    }

    @Override
    public void modifySysRoleMenu(AssginMenuDto assginMenuDto) {
        //删除当前角色id的所有菜单
        sysRoleMenuMapper.deleteSysRoleMenuByRoleId(assginMenuDto.getRoleId());

        //插入当前角色id和菜单id
        System.out.println(1);
        sysRoleMenuMapper.insertSysRoleMenu(assginMenuDto);
        System.out.println(2);

    }
}
